package com.itbaizhan.controller;

/**
 * @author spf
 * @date 2024/3/4
 * @time 14:53
 */

import com.itbaizhan.pojo.Item;
import com.itbaizhan.result.BaseResult;
import com.itbaizhan.service.RecommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 热门推荐控制器
 */
@RestController
@RequestMapping("/recommendation")
public class RecommendationController {

    @Autowired
    private RecommentService recommentService;

    /**
     * 查询热门推荐商品
     * @param city
     * @return
     */
    @GetMapping("/findRecommendationPage")
    public BaseResult<List<Item>> findRecommendationPage(@RequestParam("city") String city){
        List<Item> recommendation = recommentService.getRecommendation(city);
        return BaseResult.ok(recommendation);
    }

}
